<? include '../server_config.php'; ?>
<? 

if($_SESSION['admin']!=true)
{
	?>
	<script>location.href='login.php'</script>
	<?
	return;
}

?>
<br>
<? 
if($_GET['type']==1) echo "Interior Work";
else if($_GET['type']==2) echo "Design Product";
else if($_GET['type']==3) echo "Display";
?><br>
<br>


<?
	$sql = "SELECT * FROM ud_work WHERE type='".$_GET['type']."' ORDER BY reg_timestamp DESC;";
	
	
	$result = mysql_query($sql,$connect);

	while($row = mysql_fetch_row($result))
	
	{

?>
	<hr>
	<? echo $row[4]." - ".$row[6];?><br><br>

	<?
		if($_GET['type']==3) 
		{
		?>
	<img src='./file/<? echo $row[7]; ?>?a=<? echo rand(1,100);?>' width='200px' height='150px'> 
	<?
		}
		else
		{
		?>
		<img src='./file/<? echo $row[2]; ?>?a=<? echo rand(1,100);?>' width='200px' height='150px'>
		<?
		}
		?>

	 <img src='./file/<? echo $row[3]; ?>?a=<? echo rand(1,100);?>' width='200px' height='150px'> 
	<br><br>
	<? echo $row[5];?><br>
	<br>
	- <a href="work_del_proc.php?idx=<? echo $row[0];?>">삭제</a>
	<br>
	<br>
	<div style='background:#eeeeee;padding:10px;'>
		수정<br>
		<br>
		<form method="post" enctype="multipart/form-data" action="work_add_proc.php">
			<input type='hidden' value='<? echo $row[0];?>' name='w_idx'>
			<input type='hidden' value='<? echo $_GET['type']; ?>' name='w_type'>
			제목 : <input type='text' name='w_title' value='<? echo $row[4];?>'><br>
			<?
				if($_GET['type']==3) 
				{
				?>
			목록이미지 (926x299) <input type="file" name="file3" /><br>
				<?
				}
				else
				{
				?>
			작은이미지 (449x299) <input type="file" name="file1" /><br>		
				<?
				}
				?>
			큰이미지 (926x)<input type="file" name="file2" /><br>
			설명 : <textarea name='w_description' cols=40 rows=10><? echo $row[5];?></textarea>
		  <input type="submit" value="저장"></input>
		</form> 
	</div>
<?
	}
?>

<hr>
추가<br>
<br>
<form name="fileForm" method="post" enctype="multipart/form-data" action="work_add_proc.php">
	<input type='hidden' value='<? echo $_GET['type']; ?>' name='w_type'>
	제목 : <input type='text' name='w_title'><br>
	<?
		if($_GET['type']==3) 
		{
		?>
	목록이미지 (926x299) <input type="file" name="file3" /><br>
		<?
		}
		else
		{
		?>
	작은이미지 (449x299) <input type="file" name="file1" /><br>		
		<?
		}
		?>
	큰이미지 (926x)<input type="file" name="file2" /><br>
	설명 : <textarea name='w_description' cols=40 rows=10></textarea>
  <input type="submit" value="저장"></input>
</form> 
